package com.oocl.crm.util;

import java.io.OutputStream;

import com.oocl.crm.db.MyLinkedList;
import com.oocl.crm.pojo.Customer;

public class FormatPrinter {
	public static void printHelpDoc(String s, OutputStream out) {
		if(s.length() == 1){
			System.out.println( "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" );
	        System.out.println( "+                         Welcome to CRM System!                             +" );
	        System.out.println( "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" );
			System.out.println("Now there are 10 customers in the system!\n");
			System.out.println("-- Look: L [id:xx/name:xx,sex:man/woman,birthday:YYYY-MM-DD,address:xx,cell:xx] \n"
					+ "-- Add: A name:xx[,sex:man/woman,birthday:YYYY-MM-DD,address:xx,cell:xx] \n"
					+ "-- Delete: D id \n"
					+ "-- Modify: U id name:xx[,sex:man/woman,birthday:YYYY-MM-DD,address:xx,cell:xx] \n"
					+ "-- Sort: O name/id \n"
					+ "-- Help: H [L/A/D/U/O/Q]\n"
					+ "-- Quit: Q");
		}else{
			switch (s.substring(2, s.length())) {
			case "A":
				System.out.println("Add: A name:xx[,sex:man/woman,birthday:YYYY-MM-DD,address:xx,cell:xx]");
				break;
			case "L":
				System.out.println("Look: L [id:xx/name:xx,sex:man/woman,birthday:YYYY-MM-DD,address:xx,cell:xx]");
				break;
			case "D":
				System.out.println("Delete: D id");
				break;
			case "O":
				System.out.println("Sort: O name/id");
				break;
			case "Q":
				System.out.println("Quit: Q");
				break;
			case "H":
				System.out.println("Help: H [L/A/D/U/O/Q]");
				break;
			case "U":
				System.out.println("Modify: U id name:xx[,sex:man/woman,birthday:YYYY-MM-DD,address:xx,cell:xx]");
				break;
			default:
				break;
			}
		}
	}

	public static void printCustomers(Customer[] cs, OutputStream out) {
		System.out.println("ID \tNAME \tSEX \tBIRTHDAY \tADDRESS \tCELL");
		for(int i=0; i<cs.length; i++){
			Customer customer = cs[i];
			if(customer!=null){
				System.out.println(customer.toString());
			}
			
		}
	}
}
